package com.zlsy.springbootdemo.rabbitmq.consumer;

import com.zlsy.springbootdemo.rabbitmq.stream.Sink;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

/**
 * @author zhouliang
 * @date 2021/1/6 20:42
 */
@Component
public class PartitionConsumer {
  @StreamListener(Sink.PARTITION_INTPUT)
  public void listen(@Payload String in, @Header(AmqpHeaders.CONSUMER_QUEUE) String queue) {
    System.out.println(in + " received from queue " + queue);
  }
}
